package org.parklab.lab.web.server.database;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.users.User;



@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class UserLogon implements Serializable {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	protected User user;

	@Persistent
	protected Date lastLogin;
	
	
	public String toString() {
		return "UserLogon(" + Integer.toString(this.hashCode()) +
		"), user(" + this.user.getNickname() + "(" + this.user.getEmail() + "," + this.user.getUserId() + ")" +  
		"), lastLogin(" + this.lastLogin.toString() +
		")";
	}
	
	
	
	
	
	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * @return the lastLogin
	 */
	public Date getLastLogin() {
		return lastLogin;
	}

	/**
	 * @param lastLogin the lastLogin to set
	 */
	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}

	public UserLogon() { } // for Serializability

	public UserLogon(User user) {
		this.user = user;
	}

	public Long getId() {
		return id;
	}
}